From fd24f14fe4867cd41ddc00fe41ed3f5a01326c01 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 29 Mar 2006 13:56:26 +0100 Subject: [PATCH] SVM patch to update guest time with latest hvm modifications. Signed-off-by: Tom Woller --- xen/arch/x86/hvm/svm/intr.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 5 +++-- xen/arch/x86/hvm/svm/vmcb.c | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c index 46de3cd40a..6d3289e695 100644 --- a/xen/arch/x86/hvm/svm/intr.c +++ b/xen/arch/x86/hvm/svm/intr.c @@ -81,7 +81,7 @@ interrupt_post_injection(struct vcpu * v, int vector, int type) } vpit->inject_point = NOW(); - vpit->last_pit_gtime += vpit->period; + vpit->last_pit_gtime += vpit->period_cycles; svm_set_guest_time(v, vpit->last_pit_gtime); } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index dcecfda39f..d43bfb08d8 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -674,9 +674,10 @@ static void svm_freeze_time(struct vcpu *v) { struct hvm_virpit *vpit = &v->domain->arch.hvm_domain.vpit; - v->domain->arch.hvm_domain.guest_time = svm_get_guest_time(v); - if ( vpit->first_injected ) + if ( vpit->first_injected && !v->domain->arch.hvm_domain.guest_time ) { + v->domain->arch.hvm_domain.guest_time = svm_get_guest_time(v); stop_timer(&(vpit->pit_timer)); + } } static void svm_ctxt_switch_from(struct vcpu *v) diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c index 8b46e104e5..0d101206b6 100644 --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -498,8 +498,11 @@ void svm_do_resume(struct vcpu *v) svm_stts(v); /* pick up the elapsed PIT ticks and re-enable pit_timer */ - if ( vpit->first_injected) { - svm_set_guest_time(v, v->domain->arch.hvm_domain.guest_time); + if ( vpit->first_injected ) { + if ( v->domain->arch.hvm_domain.guest_time ) { + svm_set_guest_time(v, v->domain->arch.hvm_domain.guest_time); + v->domain->arch.hvm_domain.guest_time = 0; + } pickup_deactive_ticks(vpit); } @@ -511,7 +514,6 @@ void svm_do_resume(struct vcpu *v) ASSERT(!test_bit(ARCH_HVM_IO_WAIT, &v->arch.hvm_vcpu.ioflags)); } - void svm_launch_fail(unsigned long eflags) { BUG(); -- 2.30.2